package com.oocl.util;

import java.io.File;
import java.io.IOException;

import org.springframework.web.multipart.MultipartFile;

public class FileOperatorUtil {
   
	public static void saveFile(MultipartFile file,String savePosition) throws IllegalStateException, IOException{
		 File targetFile = new File(savePosition);  
	        if(!targetFile.exists()){  
	            targetFile.mkdirs();  
	        }  
	        //保存  
	      file.transferTo(targetFile);  
	}	
	
	
	public static void removeFile(String savePosition){
		new File(savePosition).delete();
	}
	
	
	
	public static String getFileName(){
		String fileName="";
		for (int i = 0; i < 6; i++) {
			fileName=fileName+(int)(Math.random()*10);
		}
		return fileName;
	}
	
}
